import pandas as pd

# 创建DataFrame
data = {
    'createTime': ['2020-03-16 11:30:18', '2020-03-16 10:58:48', '2020-03-16 10:46:39', '2020-03-16 10:45:44',
                   '2020-03-16 10:20:41'],
    'education': ['本科', '本科', '不限', '本科', '本科'],
    'salary': ['20k-35k', '20k-40k', '20k-35k', '13k-20k', '10k-20k']
}

df = pd.DataFrame(data)


def avg_salary(salary):
    parts = salary.split('-')
    min_salary = int(parts[0].replace('k', '')) * 1000
    max_salary = int(parts[1].replace('k', '')) * 1000
    return (int(min_salary) + int(max_salary)) / 2


df['salary'] = df['salary'].apply(avg_salary)
bins = [0, 5000, 20000, 50000]
df['category'] = pd.cut(df['salary'], bins, labels=['低', '中', '高'])
print(df)
